

<%@ page import="bookstore.base.Livro" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'livro.label', default: 'Livro')}" />
        <title><g:message code="default.edit.label" args="[entityName]" /></title>
    </head>
    <body>
        <br/><br/>
        <div class="body">
            <h1><g:message code="default.edit.label" args="[entityName]" /></h1><br/>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${livroInstance}">
            <div class="errors">
                <g:renderErrors bean="${livroInstance}" as="list" />
            </div>
            </g:hasErrors>
            <g:form method="post" >
                <g:hiddenField name="id" value="${livroInstance?.id}" />
                <g:hiddenField name="version" value="${livroInstance?.version}" />
                <div class="dialog">
                    <table>
                        <tbody>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="qtde"><g:message code="livro.qtde.label" default="Qtde" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: livroInstance, field: 'qtde', 'errors')}">
                                    <g:textField name="qtde" value="${fieldValue(bean: livroInstance, field: 'qtde')}" />
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="titulo"><g:message code="livro.titulo.label" default="Titulo" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: livroInstance, field: 'titulo', 'errors')}">
                                    <g:textField name="titulo" value="${livroInstance?.titulo}" />
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="autor"><g:message code="livro.autor.label" default="Autor" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: livroInstance, field: 'autor', 'errors')}">
                                    <g:textField name="autor" value="${livroInstance?.autor}" />
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="ISBN"><g:message code="livro.ISBN.label" default="ISBN" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: livroInstance, field: 'ISBN', 'errors')}">
                                    <g:textField name="ISBN" value="${livroInstance?.ISBN}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="preco"><g:message code="livro.preco.label" default="Preco" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: livroInstance, field: 'preco', 'errors')}">
                                    <g:textField name="preco" value="${fieldValue(bean: livroInstance, field: 'preco')}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="editora"><g:message code="livro.editora.label" default="Editora" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: livroInstance, field: 'editora', 'errors')}">
                                    <g:select name="editora.id" from="${bookstore.base.Editora.list()}" optionKey="id" value="${livroInstance?.editora?.id}"  />
                                </td>
                            </tr>
                        
                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><g:actionSubmit class="save" action="update" value="${message(code: 'default.button.update.label', default: 'Update')}" /></span>
                    <span class="button"><g:actionSubmit class="delete" action="delete" value="${message(code: 'default.button.delete.label', default: 'Delete')}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" /></span>
                </div>
            </g:form>
        </div>
    </body>
</html>
